<?php

class BookTable extends Doctrine_Table
{
	public function getWithInventory()
	{
		$q = $this->createQuery('b')
		->leftJoin('b.Inventory a')
		->where ('a.state_id > ?', 1)
		->where('a.expires_at > ?', date('Y-m-d H:i:s', time()))
		->orderBy('b.title ASC');
		    
		return $q;
	}
		
}